Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ImageGadget : Fix active not being reset when reverting to stored tile #4011

Closed

Conversation

danieldresser-ie
Copy link
Contributor

Turned out to be a very simple fix, once we had the repro that John found.

Copy link
Member

@johnhaddon johnhaddon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Daniel. This fixes the "switch back to cached value" bug, but I just found another repro that it doesn't address fully :

  • Checkerboard followed by 300px Blur, viewing the Blur.
  • Let the image render completely, then increase blur to 301px.
  • Wait for the image to be roughly 50% updated and increase blur to 302px.
  • The active indicators will be stuck on for the middle tiles until the 302px update reaches them.

I think we need to fix this by wrapping the ConstFloatVectorDataPtr channelData = image->channelDataPlug()->getValue( &h ); with a try/catch( ... ). In catch we would need to reset m_active and then rethrow the original exception.

Cheers...
John

@danieldresser-ie
Copy link
Contributor Author

Hmm, after thinking about this a bit more, this is maybe a bit more philosophically complicated - it comes down to what are these indicators actually used for?

It sounds like your interpretation is: these are the buckets that currently have threads working on them. This is a straightforward definition, but I'm not sure if users actually care about it.

To me, the useful thing to know is: is this bucket stale, or is it up to date. From that point of view, we've tagged the bucket as out of date because we've started processing it, and it's still out of date. I'm not sure it's wrong from a user point of view to leave it tagged - the abandoned bucket is going to take a long time to finish processing, because there is no current thread assigned to it, but from a user point of view - we've started processing it, and we haven't finished processing it yet.

I suppose if you actually thought this was a reasonable way of approaching it, we would just flag all tiles as out of date as soon as an update occured, so you probably will want to use the try/catch approach.

What I realized when thinking about that approach from my point of view though, is that to me, the most important thing to communicate through this UI is "this bucket is an up-to-date, accurate representation of the current state of the upstream network". And currently our indicator for that is "At the moment you see the indicator disappear, that is true". We would be removing that association ... which maybe is worth thinking about?

@johnhaddon
Copy link
Member

The intention behind the indicators is definitely to show which tiles are being worked on, hence m_active. I believe we should fix the implementation of this using the exception handler we discussed.

The "how do I know which tiles are stale?" question is a reasonable one, but a separate topic. I'm not aware of other compositors or renderers trying to do more than highlight the active regions, and personally I struggle to see an approach that doesn't result in a lot of visual noise. The current active indicators and tile order give a pretty good indication of where the "high water mark" of up-to-dateness. Note that the implementation goes out of its way not to flash the indicators when updates are very fast, which I think is an indication of a general aversion to additional visual noise amongst our users.

@danieldresser-ie
Copy link
Contributor Author

Updated under protest - I increasingly feel that thread assignment is not the useful information to communicate about the state of the image, but based on variable names rather than what's useful, then this is certainly more accurate.

Actually, that's stating my case too strongly - by far the most common case is that the image updates fast enough that you don't really need to think about which tiles have been updated. It's only in extremely slow cases where you would need to actually think about whether tiles are up to date - I'm only thinking about it because this last fix only applies in those extremely slow cases, and I do still feel like it potentially makes things less clear in the only cases where it's a noticeable change.

Anyway, you should take a look at the code - I wasn't completely sure how to square the easiest place to put a completely reliable catch with m_active being private.

@johnhaddon
Copy link
Member

Closing in favour of #5348.

@johnhaddon johnhaddon closed this Jun 13, 2023
johnhaddon added a commit to johnhaddon/gaffer that referenced this pull request Sep 18, 2024
Because of the way we were suppressing exceptions in `Tile::computeUpdate()`, we could end up calling `Tile::applyUpdates()` with an incomplete set of updates (where some have null `channelData`). This could cause us to display a tile with a mix of updated and stale channels, causing the very "colour tearing" that `applyUpdates()` was intended to avoid.

We now handle exceptions one level higher up in the `tileFunctor`, allowing us to clear the active flags for all channels, but _not_ apply any channel data updates. This approach is much closer to the one originally proposed in GafferHQ#4011, which I replaced with a botched version in GafferHQ#5348.
johnhaddon added a commit to johnhaddon/gaffer that referenced this pull request Sep 18, 2024
Because of the way we were suppressing exceptions in `Tile::computeUpdate()`, we could end up calling `Tile::applyUpdates()` with an incomplete set of updates (where some have null `channelData`). This could cause us to display a tile with a mix of updated and stale channels, causing the very "colour tearing" that `applyUpdates()` was intended to avoid.

We now handle exceptions one level higher up in the `tileFunctor`, allowing us to clear the active flags for all channels, but _not_ apply any channel data updates. This approach is much closer to the one originally proposed in GafferHQ#4011, which I replaced with a botched version in GafferHQ#5348.
johnhaddon added a commit to johnhaddon/gaffer that referenced this pull request Sep 19, 2024
Because of the way we were suppressing exceptions in `Tile::computeUpdate()`, we could end up calling `Tile::applyUpdates()` with an incomplete set of updates (where some have null `channelData`). This could cause us to display a tile with a mix of updated and stale channels, causing the very "colour tearing" that `applyUpdates()` was intended to avoid.

We now handle exceptions one level higher up in the `tileFunctor`, allowing us to clear the active flags for all channels, but _not_ apply any channel data updates. This approach is much closer to the one originally proposed in GafferHQ#4011, which I replaced with a botched version in GafferHQ#5348.
johnhaddon added a commit to johnhaddon/gaffer that referenced this pull request Sep 23, 2024
Because of the way we were suppressing exceptions in `Tile::computeUpdate()`, we could end up calling `Tile::applyUpdates()` with an incomplete set of updates (where some have null `channelData`). This could cause us to display a tile with a mix of updated and stale channels, causing the very "colour tearing" that `applyUpdates()` was intended to avoid.

We now handle exceptions one level higher up in the `tileFunctor`, allowing us to clear the active flags for all channels, but _not_ apply any channel data updates. This approach is much closer to the one originally proposed in GafferHQ#4011, which I replaced with a botched version in GafferHQ#5348.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants